package common.data.report
{
	import mx.rpc.events.ResultEvent;
	import mx.rpc.remoting.RemoteObject;

	/**
	 * 定位服务类
	 */
	public class StaffTravelReportService extends RemoteObject
	{
		public var queryStaffTravelPlansReportCallBack:Function;
		public var queryStaffTravelPlanReportCallBack:Function;
		public var querySingleVisitedReportCallBack:Function;
		
		public function StaffTravelReportService() {
			super("travelReportService");
			this.showBusyCursor = true;
			this.getOperation("queryStaffTravelPlansReport").addEventListener(ResultEvent.RESULT,queryStaffTravelPlansReportResult,false,0,true);
			this.getOperation("queryStaffTravelPlanReport").addEventListener(ResultEvent.RESULT,queryStaffTravelPlanReportResult,false,0,true);
			this.getOperation("querySingleVisitedReport").addEventListener(ResultEvent.RESULT,querySingleVisitedReportResult,false,0,true);
		}
		
		public function queryStaffTravelPlansReport(staffId:String,startDate:String,endDate:String):void{
			this.getOperation("queryStaffTravelPlansReport").send(staffId,startDate,endDate);
		}
		public function queryStaffTravelPlanReport(staffId:String,regionId:String,startDate:String,endDate:String):void{
			this.getOperation("queryStaffTravelPlanReport").send(staffId,regionId,startDate,endDate);
		}
		public function querySingleVisitedReport(staffId:String,startDate:String,endDate:String):void{
			this.getOperation("querySingleVisitedReport").send(staffId,startDate,endDate);
		}
		//回调根据员工ID集合获取实时定位信息
		private function queryStaffTravelPlansReportResult(e:ResultEvent):void{
			try{
				if(queryStaffTravelPlansReportCallBack != null){
					queryStaffTravelPlansReportCallBack.apply(this,[e]);
				}
			}catch(error:Error){
				trace(error.getStackTrace());
			}
		}
		
		private function queryStaffTravelPlanReportResult(e:ResultEvent):void{
			try{
				if(queryStaffTravelPlanReportCallBack != null){
					queryStaffTravelPlanReportCallBack.apply(this,[e]);
				}
			}catch(error:Error){
				trace(error.getStackTrace());
			}
		}
		
		private function querySingleVisitedReportResult(e:ResultEvent):void{
			try{
				if(querySingleVisitedReportCallBack != null){
					querySingleVisitedReportCallBack.apply(this,[e]);
				}
			}catch(error:Error){
				trace(error.getStackTrace());
			}
		}
		
	}
}	